const Mserver = require('node-media-server')

const config = {
  rtmp: {
    port: 8081,
    chunk_size: 60000,
    gop_cache: true,
    ping: 60,
    ping_timeout: 30
  },
  http: {
    port: 3001,
    allow_origin: '*',
    webroot: './public',
    mediaroot: './media'
  },
  trans: {  
    ffmpeg: 'E:\\Software\\ffmpeg\\bin\\ffmpeg.exe',  
    tasks: [   
      {  
        app: 'live',  
        ac: 'copy',  
        hls: true,  
        hlsFlags: '[hls_time=2:hls_list_size=3:hls_flags=delete_segments]',  
        dash: true,  
        dashFlags: '[f=dash:window_size=3:extra_window_size=5]'  
      }  
    ]  
  }
}

var nms = new Mserver.NodeMediaServer(config)

nms.run()
